package leetcode.code1096;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public List<String> braceExpansionII(String expression) {
		char[] exp = expression.toCharArray();
		int n = exp.length;
		int[] nextRight = new int[n + 1];
		int[] nextLeft = new int[n + 1];
		int[] nextComma = new int[n + 1];
		nextComma[n] = -1;
		nextLeft[n] = -1;
		nextRight[n] = -1;
		for (int i = n - 1; i >= 0; i--) {
			char c = exp[i];
			nextComma[i] = c == ',' ? i : nextComma[i + 1];
			nextLeft[i] = c == '{' ? i : nextLeft[i + 1];
			nextRight[i] = c == '}' ? i : nextRight[i + 1];
		}
		H.print(nextComma);
		H.print(nextLeft);
		H.print(nextRight);
		return null;
	}

	@Override
	public void debug4() {
		H.print(this.braceExpansionII("{aaa{d,e}}"));
//		H.print(this.braceExpansionII("{a,b}{c,aaa{d,e}}"));
//		H.print(this.braceExpansionII("{a,b}{c,{d,e}}"));
//		H.print(this.braceExpansionII("{a{a{c,d,a{d,e}{c,d}a,a{d,e}{c,d}a,{d,e}{c,d}a}},{e,f}}"));
//		H.print(this.braceExpansionII("{a,b}{c,{d,e}}"));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
